<template>
	<el-container>
		<el-aside>
		</el-aside>
		<el-container>
			<el-main className="nopadding" style="width: 100%;">
				<el-card shadow="never" header="积分规则设置">
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="超时时长" prop="passTime">
								<el-input-number v-model="form.passTime" clearable></el-input-number>/天
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="超时扣分" prop="passTimePoint">
								<el-input-number v-model="form.passTimePoint" clearable></el-input-number>/分
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="延期时长" prop="delay">
								<el-input-number v-model="form.delay" clearable></el-input-number>/天
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="超时扣分" prop="delayPoint">
								<el-input-number v-model="form.delayPoint" clearable></el-input-number>/分
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="系统得分权重" prop="sysWeight">
								<el-input-number v-model="form.sysWeight" clearable></el-input-number>%
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="督查领导得分权重" prop="userWeight">
								<el-input-number v-model="form.userWeight" clearable></el-input-number>%
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="总分" prop="totalPoints">
								<el-input-number v-model="form.totalPoints" clearable></el-input-number>/分
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="打分领导" prop="leadId">
								<select-user-dialog v-model:accountId="form.leadId" :mode="false"/>
							</el-form-item>
						</el-col>
					</el-row>
					<div style="text-align: center;">
						<el-button type="primary"  @click="setSupervisionIntegral()">设 置</el-button>
					</div>
				</el-card>
			</el-main>
		</el-container>
		<el-aside>
		</el-aside>
	</el-container>
</template>

<script>
import SelectUserDialog from "@/views/module/selectUserDialog";
export default {
	name: 'Supervision Integral Setting',
	components: {SelectUserDialog},
	data() {
		return {
			form: {
				passTime: 0,
				passTimePoint:0,
				delay:0,
				delayPoint:0,
				sysWeight:0.0,
				userWeight:0.0,
				totalPoints:0,
				leadId:'',
			}
		}
	},
	mounted() {
		this.getSupervisionIntegral();
	},
	methods: {
		async setSupervisionIntegral() {
			let res = await this.$API.supervision.supervisionIntegral.setSupervisionIntegral.post(this.form);
			if (res.code == 200) {
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getSupervisionIntegral(){
			var res = await this.$API.supervision.supervisionIntegral.getSupervisionIntegral.get();
			if(res.code == 200){
				this.form = res.data;
			}else{
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
.title {
	font-weight: 600;
	font-size: 20px;
}
</style>
